<template>
  <view>
    <!-- 条件编译小组件 -->
    <ifdef></ifdef>
    <view>请在下方输入内容</view>
    <input type="text" :value="str" placeholder="请输入内容" @input="onKeyInput" />
    <view>你输入的内容是{{ str }}</view>
    <button type="primary" @tap="addNum(1)">+</button>
    <button type="primary" @tap="addNum(-1)">-</button>
  </view>
</template>

<script>
  import ifdef from '../../components/ifdef/ifdef.vue';
export default {
  components: {
    ifdef
  },
  data() {
    return {
      str: ''
    };
  },
  methods: {
    onKeyInput: function(event) {
      // console.log(event);
      this.$data.str = event.detail.value;
    },
    addNum: function(num) {
      this.$data.str = Number(this.$data.str) + num;
    }
  }
};
</script>

<style lang="less"></style>
